home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 14 / CU Amiga Magazine's Super CD-ROM 14 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-09].iso / CUCD / Programming / Mesa-2.2 / mklib.linux < prev    next >
Encoding:
Text File  |  1997-01-07  |  1004 b   |  48 lines

  1. #!/bin/sh
  2.  
  3. # Make a Linux ELF shared library
  4.  
  5. # First argument is name of output library
  6. # Rest of arguments are object files
  7.  
  8. LIBRARY=$1
  9.  
  10. shift 1
  11. OBJECTS=$*
  12.  
  13. # the following provided by Thomas Hiller (Hiller@tu-harburg.d400.de)
  14.  
  15. LIBMAJOR=2
  16. LIBMINOR=2
  17. VERSION="${LIBMAJOR}.${LIBMINOR}"
  18.  
  19. LIBNAME=`basename $LIBRARY`
  20. ARNAME=`basename $LIBNAME .so`.a
  21. DIRNAME=`dirname $LIBRARY`
  22.  
  23. gcc -shared -Wl,-soname,${LIBNAME}.${LIBMAJOR} -o ${LIBRARY}.${VERSION} ${OBJECTS}
  24. (cd $DIRNAME; ln -s ${LIBNAME}.${VERSION} ${LIBNAME}.${LIBMAJOR})
  25.  
  26. ln -s ${LIBNAME}.${LIBMAJOR} ${LIBRARY}
  27.  
  28.  
  29. # also make regular .a files,
  30. # provided by Danek Duvall (duvall@dhduvall.student.princeton.edu)
  31.  
  32. ar ruv ${DIRNAME}/${ARNAME} ${OBJECTS}
  33. ranlib ${DIRNAME}/${ARNAME}
  34.  
  35.  
  36. # Print a reminder about shared libs:
  37. DIR=`cd .. ; pwd`
  38. echo
  39. echo "******Be sure to add" ${DIR}"/lib to your LD_LIBRARY_PATH variable"
  40. echo
  41. sleep 2
  42.  
  43.  
  44.  
  45. #### NOTES:
  46. # One Mesa user reports having to run the "ldconfig -v" command to make
  47. # Linux aware of the shared libs.
  48.